﻿<Window x:Class="TreeViewEx.ComplexSample.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=TreeViewEx"
        xmlns:Model="clr-namespace:TreeViewEx.ComplexSample.Model" xmlns:local="clr-namespace:TreeViewEx.ComplexSample"
        Title="MainWindow" Height="357" Width="800" AutomationProperties.Name="TestApp2Window" BorderBrush="#FF3E3E3E"
        BorderThickness="1">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/ComplexSample;component/Resources/SimpleNode.xaml" />
                <ResourceDictionary Source="/ComplexSample;component/Resources/DateNode.xaml" />
                <ResourceDictionary Source="/ComplexSample;component/Resources/NumberNode.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style x:Key="contentStyle" TargetType="{x:Type FrameworkElement}">
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>

            <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource contentStyle}">
                <Setter Property="HorizontalAlignment" Value="Center" />
            </Style>

            <Style TargetType="{x:Type Label}" BasedOn="{StaticResource contentStyle}">
            </Style>

            <DataTemplate x:Key="noNodeTemplate">
                <Label Content="Please select a node from the list!" HorizontalAlignment="Center" />
            </DataTemplate>

            <local:DetailTemplateSelector x:Key="detailTemplateSelector" />

            <local:TreeItemStyleSelector x:Key="treeItemStyleSelector" />
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <Label DockPanel.Dock="Bottom" x:Name="MessageLabel" Height="25"/>
        <StackPanel Orientation="Horizontal">
            <Controls:TreeViewEx HierarchicalItemsSource="{Binding Path=NodeTree}" Width="200" Margin="10"
                    ItemContainerStyleSelector="{StaticResource treeItemStyleSelector}" OnSelecting="TreeViewEx_OnSelecting"/>
            <ListBox ItemsSource="{Binding Path=NodeList}" Width="200" Margin="10" Name="ListBox" />
            <Border BorderBrush="#FF6F6F6F" BorderThickness="1" Margin="10">
                <ContentControl Content="{Binding ElementName=ListBox, Path=SelectedItem}" Width="300"
                        ContentTemplateSelector="{StaticResource detailTemplateSelector}" />
            </Border>
        </StackPanel>
    </DockPanel>
</Window>
